﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace DELVE_GAME
{
    [Serializable]
    enum GameType
    {
        ENDURANCE,
        TERRITORIES,
        QUICK_WIN,
        TERRITORY_RACE,

        NUM_TYPES
    }

    [Serializable]
    public class GameSettings
    {
        const int DEFAULT_GAMETYPE = (int)GameType.ENDURANCE;
        const int DEFAULT_TURN_LIMIT = 2;
        const int DEFAULT_NUM_PLAYERS = 2;
        const bool DEFAULT_FOG_OF_WAR = true;
        const int DEFAULT_TIME_LIMIT = -1;

        public string mapName;
        public int gameType;
        public int startingPotencyGauge;
        public bool fogOfWar;
        public int turnLimit;
        public int timeLimit;
        public int numPlayers;

        public GameSettings() {
            gameType = DEFAULT_GAMETYPE;
            startingPotencyGauge = (int) PLAYER_DEFAULTS.STARTING_POTENCY;
            fogOfWar = DEFAULT_FOG_OF_WAR;
            turnLimit = DEFAULT_TURN_LIMIT;
            timeLimit = DEFAULT_TIME_LIMIT;
            numPlayers = DEFAULT_NUM_PLAYERS;
        }

        public int getGameType() { return gameType; }

        public void setMapName(string name) {
            if (name != null) this.mapName = name;
        }
        
        public void setGameType(int gameType)
        {
            if (gameType >= 0 || gameType < (int)GameType.NUM_TYPES)
                this.gameType = gameType;
        }

        public int getStartingPotencyGauge() { 
            return this.startingPotencyGauge; 
        }
        public void setStartingPotency(int startingPotency)
        {
            if (startingPotency >= 0 || startingPotency < (int)PLAYER_DEFAULTS.MAX_POTENCY)
                this.startingPotencyGauge = startingPotency;
        }

        public bool getFogOfWar() { return fogOfWar; }
        public void setFogOfWar(bool fogOn) { fogOfWar = fogOn; }

        public int getTurnLimit() { return turnLimit; }
        public void setTurnLimit(int turnLimit) {
            if (turnLimit > 0)
            
                this.turnLimit = turnLimit;
        }

        public int getTimeLimit() { return timeLimit; }
        public void setTimeLimit(int timeLimit)
        {
            this.timeLimit = timeLimit;
        }

        public int getNumPlayers() { return numPlayers; }
        public void setNumPlayers(int myNumPlayers)
        {
            if (myNumPlayers > 0 && myNumPlayers < 5)
                this.numPlayers = myNumPlayers;
        }
    }
}
